/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hu.rsc.feeds.server;

import it.sauronsoftware.feed4j.FeedParser;
import it.sauronsoftware.feed4j.bean.Feed;
import it.sauronsoftware.feed4j.bean.FeedHeader;
import it.sauronsoftware.feed4j.bean.FeedItem;

import java.net.URL;

public class Test {

    public static void main(String[] args) {
	try {
	    URL url = new URL("http://gdata.youtube.com/feeds/api/users/garyferro/favorites?orderby=updated");
	    Feed feed = FeedParser.parse(url);

	    System.out.println("** HEADER **");
	    FeedHeader header = feed.getHeader();
	    System.out.println("Title: " + header.getTitle());
	    System.out.println("Link: " + header.getLink());
	    System.out.println("Description: " + header.getDescription());
	    System.out.println("Language: " + header.getLanguage());
	    System.out.println("PubDate: " + header.getPubDate());

	    System.out.println("** ITEMS **");
	    int items = feed.getItemCount();
	    for (int i = 0; i < items; i++) {
		FeedItem item = feed.getItem(i);
		System.out.println("Title: " + item.getTitle());
		System.out.println("Link: " + item.getLink());
		System.out.println("Plain text description: " + item.getDescriptionAsText());
		System.out.println("HTML description: " + item.getDescriptionAsHTML());
		System.out.println("PubDate: " + item.getPubDate());
	    }
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }
}
